﻿@model ProyectoGoya.Models.Firma
<div id="firmaForm">
    @using (Ajax.BeginForm("Create", "Firma", new AjaxOptions { HttpMethod = "POST", InsertionMode = InsertionMode.Replace, UpdateTargetId = "firmaForm", OnSuccess = "javascript:onSuccess()"}))
    {
        @Html.ValidationSummary(true)

        @Html.EditorForModel()
        <br />
        <p>
            <input type="submit" class="submit" value="Firmar" />
        </p>
    }
</div>
<div id="dialog-modalSuccess" title="Firma guardada" style="display: none">
    <p>
        Gracias por ayudar a salvar tu ciudad.
    </p>
</div>
<script type="text/javascript">


    $(document).ready(function () {
        $.validator.unobtrusive.parse("#firmaForm");
    });

    function onSuccess() {
        
        var ss = '@ViewBag.SaveSuccessful';
        if (ss == 'True') {
            $("#dialog-modalSuccess").dialog({
                height: 160,
                modal: true,
                buttons: {
                    "Cerrar": function () {
                        $(this).dialog("close");
                    }
                }
            });
        }
    }
</script>
